<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
	$(function(){
		$('#element_diaryForm').form({
					    url:'easyUi/diaryAction!saveDiary.action',
						success:function(r){
							var obj= jQuery.parseJSON(r);
					    	if(obj.success){
							 $.messager.show({
								title:'提示',
								msg:obj.msg
							 });
							}
						}
					});
				//可查jquery手册，增加回车功能 就提交  必须将功能写成来 如登录功能，注册功能写法就不行
			  $('#element_diaryForm input').bind('keyup',function(event){
				if(event.keyCode=='13'){
					$('#element_diaryForm').submit();
			 }
		});
		window.setTimeout(function(){
			$('#element_diaryForm input[name=title]').focus();
		},0);
	});
</script>

<div>
	<form id="element_diaryForm" method="post">
	<table>
		<tr>
			<td>
				标题：
			</td>
			<td>
				<input class="easyui-validatebox" name="title" data-options="required:true,validType:'length[1,20]'">
			</td>
		</tr>
		<tr>
			<td>
				副标题：
			</td>
			<td>
				<input class="easyui-validatebox" style="width: 300px" name="subhead" data-options="required:true,validType:'length[1,30]'">
				<label>----------</label>
				<input id="date" name="time" class="easyui-datebox" required="required" />
			</td>
		</tr>
		<tr>
			<td>
				主要内容：
			</td>
			<td>
				<textarea class="xheditor {skin:'default'}"  name="content" rows="8" cols="110"
						upLinkUrl="upload.php" upLinkExt="zip,rar,txt" 
						upImgUrl="upload.php" upImgExt="jpg,jpeg,gif,png" 
						upFlashUrl="upload.php" upFlashExt="swf"
						upMediaUrl="upload.php" upMediaExt:"avi">
				</textarea>
				<a href="javascript:void(0)"class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="$('#element_diaryForm').submit()">保存</a>
			</td>
		</tr>
	</table>
	
</form>
</div>
